package con.shopping.manger;

import con.shopping.entity.Coupon;
import con.shopping.entity.Discount;
import con.shopping.entity.GoodDP;
import con.shopping.entity.Goods;
import con.shopping.entity.Shopping;

/**
 * @author ：河神
 * @date ：Created in 2022/2/14 8:35 下午
 */
public class ShoppingManger {

    private Shopping shopping;

    private Coupon coupon;

    public ShoppingManger() {
        shopping = new Shopping();
    }

    public void useCoupon(Coupon coupon){
        this.coupon = coupon;
    }

    public void addGoods(GoodDP goods, Integer num){
        shopping.addGoods(goods,num);
    }

    public double countMoney(){
        double price = shopping.countMoney();

        if (coupon!=null){
            price =  coupon.countCoupon(price);
        }
        return price;
    }



}
